Skip to content

fix: session and job passes for outside agents - #41

Merged
nodemode-ai merged 6 commits into
mainfrom
fix/owner-decisions-2026-11-29
Nov 30, 2026
Merged

nodemode-ai merged 6 commits into
mainfrom
fix/owner-decisions-2026-11-29

Conversation

@gbarnai

@gbarnai gbarnai commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • A pass for an agent's session is now tied to the process at the other end of the connection, found in the system's socket table, and to that process's start time. A reused process id does not keep it, and no process id means no session.
  • A pass kept past fifteen minutes by a running job covers only that job's status, result and cancel. It cannot start new jobs and ends six hours after it was given at most.
  • Job holds are keyed by job and pass together, so another job with the same id cannot end or take over a hold.
  • New module backend/app/peer_process.py (Linux /proc, macOS lsof, Windows netstat), with tests in tests/test_peer_process.py and an extended tests/test_agent_passes.py.
  • The request guard reads a request's pass once. That one answer decides both whether the request goes on and which jobs it may reach. The key check now returns the job ids directly.
  • A request let in for a pass's jobs is limited to an empty set, never left unlimited, when no job ids come with the answer.
  • Tests cover the key check's returned job set, the single read of the pass, and the empty-set limit.

Tests

  • Each change has tests that fail on the code before it.
  • The repo's CI commands were run locally on macOS; every local failure also fails on main in the same environment. Please rely on this PR's CI for Linux and Windows.

How to ship

  • Follows the earlier hardening PR, already merged. Independent of other repos. No version bump.

… its session

A pass still lasts fifteen minutes, but a job started with it (a render, a
transcription, a download) keeps it good until the job finishes, fails or
is cancelled. The security middleware records the pass a request came in
with; jobs.submit ties the new job to it and the job's last step lets go.

An agent that keeps one pass for its connection can ask with session and its
process id; the question then also offers session, and that answer gives a
pass with no age limit, good until the agent ends it, its process is gone or
the engine stops. GET /api/agent-access/pass says whether a pass is still
good. Choosing Blocked now ends every pass at once. The MCP server asks this
way, keeps a session pass across tool calls, checks it before each write
and ends it when its client disconnects.

The window's dialog is the shared dock module, which knows deny, once and
always only, so the session answer cannot be given from the window until
that module carries it.
…nd an agent's process id

A pass kept alive by a job could be stretched again and again by starting a
new job before the last one ended. Only a job started while the pass is under
fifteen minutes old now keeps it, so the pass ends with the jobs begun in the
time the person allowed.

A session request's process id is now limited to the range a process id can
take, and a process that cannot be looked at counts as gone, so a single odd id
no longer stops every later pass from being given.
…ass for that job only

A session pass is now offered only when the process id the request names is
the process at the other end of the request's connection, found in the
system's own socket table (peer_process.py: /proc on Linux, lsof on macOS,
netstat on Windows), and only when that process's start time can be read.
The pass keeps the id and the start time and is live while a process with
both is running, so an id handed to a new process later does not keep it.
A session pass with no process id is not live.

A pass past its fifteen minutes that a job keeps now reaches only that job:
its status, result and cancel over JSON-RPC and DELETE /api/jobs/{id}.
Every other write is refused, starting a job included, so a job never
extends a pass further. However long its jobs run, a pass ends six hours
after it was given. Holds are keyed by job id and pass together and
counted, and the job hands back the pass it held when it ends, so another
job with the same id cannot end or take over a hold.
…s age

The request guard now reads what a request's pass covers one time and uses
that answer both to let the request in and to limit JSON-RPC to the jobs that
keep the pass, so a job that ends in between cannot leave the request with no
limit. The read happens only when a pass decides.

A pass also keeps the wall-clock time it was given, and its age is the larger
of the steady clock's and the wall clock's, so the fifteen minutes and the six
hour limit count time the computer spends asleep.
The key check now answers both whether a request without the window key may
go on and the job ids it was let in for, and the request guard puts exactly
those ids in JOBS_ONLY. The pass is read once, inside the key check, and
nothing reads it again later. A request let in for a pass's jobs with no job
ids in hand is limited to an empty set, which reaches no job, rather than
left without a limit.
@nodemode-ai
nodemode-ai merged commit 321f2b5 into main Nov 30, 2026
8 checks passed
@nodemode-ai
nodemode-ai deleted the fix/owner-decisions-2026-11-29 branch November 30, 2026 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants